// import markDownPlugin from '../plugins/md'
import fs from 'node:fs'


// 生成侧边栏
const geneSlidebar = () => {
    const hookList = fs.readdirSync('docs/examples')
    const items = hookList.map(hookname => ({ base: '/packages/', text: `${hookname}`,  link: `/examples/${hookname}/index.md` }))

    return [
        {
            base: 'packages',
            text: 'hooks',
            items
        }
    ]
}

const slidebar = [
    {
        text: 'Guide',
        items: [
            { text: '起步', link: '/guide/start.md' },
        ]
    },
    ...geneSlidebar()
]

/**
 * @type {import('vitepress').UserConfig}
 */
export default {
    titleTemplate: 'useless',
    themeConfig: {
        siteTitle: "useless",
        // logo: "/logo.png",
        nav: [
            { text: "起步", link: "/guide/start.md" },
            { text: "API", link: "/examples/button/index.md" },
        ],
        socialLinks: [{ icon: "github", link: "https://www.baidu.com" }],
        sidebar: slidebar,
    },
    
    //   markdown: {
    //     config: (md) => {
    //       md.use(markDownPlugin)
    //     }
    //   }
} as (import('vitepress').UserConfig)
